<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
		<script language='JavaScript' src='../../adapter/ext/ext-base.js' type='text/javascript'></script>
      	<script language='JavaScript' src='../../ext-all-debug.js' type='text/javascript'></script>
      	<link rel="stylesheet" type="text/css" href="../../resources/css/ext-all.css"/>
      	<link rel="stylesheet" type="text/css" href="../../ext-patch.css"/>
        <link rel="stylesheet" type="text/css" href="../../ext-patch.css"/>
</head>
<script language="javascript">
///Ext.onReady(function()使用规则。
///是将一个启动需要执行的动作，作为一个函数传入。
Ext.onReady(function()
{
	var x=new Ext.Button({text:"一个普通按钮————警告框",renderTo:Ext.get("Button_1"),onClick:ff_warn, enableToggle:true, tooltipType:"title"})
	var x=new Ext.Button({text:"一个普通按钮____输入",renderTo:Ext.get("Button_1"),onClick:ff_input, enableToggle:true, tooltipType:"title"})
	var x=new Ext.Button({text:"一个普通按钮—————选择框",renderTo:Ext.get("Button_1"),onClick:ff_Chnage, enableToggle:true, tooltipType:"title"})
	var x=new Ext.SplitButton({text:"爱上范德萨 ",renderTo:Ext.get("Button_2"), menu:'mainMenu', arrowTooltip:"更多"})
})
///菜单项
var menu = new Ext.menu.Menu({
    id: 'mainMenu',
    items: [
        {
            text: 'menu1',
            handler: onItemCheck
        },
        {
            text: 'menu2',
            handler: onItemCheck
        }]
});

var button=new Ext.Button({
    renderTo:Ext.getBody(),
    text:'按我',
    menu:'mainMenu'
});

//有状态的探钮
new Ext.Button({
    renderTo:Ext.getBody(),
    text:'保持状态的按钮',
    enableToggle:true
});

//分组的有状态按钮
new Ext.Button({
    renderTo:Ext.getBody(),
    text:'组成单选按钮——1',
    enableToggle:true,
    toggleGroup:'toggleGroup',
    handler: onItemCheck
});


new Ext.Button({
    renderTo:Ext.getBody(),
    text:'组成单选按钮——2',
    enableToggle:true,
    toggleGroup:'toggleGroup',
    handler: onItemCheck});

	//---------------------------------------
	var action = new Ext.Action({
    text: 'Action动作事件',
    handler: function(){
        Ext.Msg.alert('Click', 'You did something.');
    },
    iconCls: 'do-something'
								})

var panel = new Ext.Panel({
    title: 'Actions',
    width:500,
    height:100,
    tbar: [
    //将action做为一个菜单按钮添加到工具栏
        action, {
            text: 'Action Menu',
        //将action做为文本选择项添加到menu
            menu: [action]
        }
    ],
    items: [
    //由action构造button,添加到panel
        new Ext.Button(action)
    ],
    renderTo: Ext.getBody()
});

// 如果这儿setText.当然button/menu/toolbar中的action文本都变了
action.setText('Something else');

/////////////////


function onItemCheck()
{}

function ff_warn()
{
	Ext.Msg.alert('Status', 'Changes saved successfully.');
	}
function ff_input()
{

Ext.Msg.prompt('Name', 'Please enter your name:', function(btn, text){
    if (btn == 'ok'){
        // process text value and close...
    }

});

function ff_Chnage()
{
// 显示一个使用配置选项的对话框：
Ext.Msg.show({
   title:'Save Changes?',
   msg: 'Your are closing a tab that has unsaved changes. Would you like to save your changes?',
   buttons: Ext.Msg.YESNOCANCEL,
   fn: processResult,
   animEl: 'elId',
   icon: Ext.MessageBox.QUESTION
});
}

	//alert('OnClieck');
	}
	
	
	
	//////////////测试辅助函数
	
	function processResult()
	{
		
		}
</script>
<body>
普通按钮
<div id="Button_1" name="Button_1" style="width:100px;height:40px"></div>

<div id="Button_2" name="Button_2" style="width:100px;height:40px"></div>
</body>
</html>
